// utils/auth.js

const getAccessToken = () => {
    return new Promise((resolve, reject) => {
        uni.getStorageSync({
            key: 'accessToken',
            success: function (res) {
                console.log(res.data);
                resolve(res.data);
            },
            fail: function (err) {
                uni.showToast({
                    title: '登录已过期，请登录',
                    icon: 'none',
                    duration: 2000
                });
                uni.reLaunch({
                    url: '/pages/login/login'
                });
                reject(err);
            }
        });
    });
};

export { getAccessToken };